/**
 * 
 */
package com.jamcodingnm.apps.abqevents.ui;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.MenuItem;
import com.jamcodingnm.apps.abqevents.R;


/**
 * @author jeremy
 *
 */
public class ItemDetailFragment extends SherlockFragment {
	
	ViewGroup mRootView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		mRootView = (ViewGroup) inflater.inflate(R.layout.item_description, null);
		
		Bundle args = getArguments();
		if (args == null) {
			return mRootView;
		}
		
		String stringText = null;
		
		TextView textView = null;
		
		stringText = args.getString("title");
		if (stringText != null) {
			textView = (TextView) mRootView.findViewById(R.id.rss_item_title);
			textView.setText(stringText);
		}
		
		stringText = args.getString("description");
		if (stringText != null) {
			textView = (TextView) mRootView.findViewById(R.id.rss_item_description);
			textView.setText(stringText);
		}
		
		stringText = args.getString("details");
		if (stringText != null) {
			textView = (TextView) mRootView.findViewById(R.id.rss_item_details);
			textView.setText(stringText);
		}
		
		stringText = args.getString("link");
		if (stringText != null) {
			textView = (TextView) mRootView.findViewById(R.id.rss_item_link);
			textView.setText(stringText);
		}
		
		return mRootView;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_share:
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

	@Override
	public void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}

}

